﻿/*
(c) 2010 - Open Source Business Foundation e. V. (www.osbf.de)
This software is provided under Microsoft Reciprocal License (Ms-RL)
(http://www.microsoft.com/opensource/licenses.mspx#Ms-RL)
All other rights reserved
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;

namespace MicroFormatProcessing
{
    /// <summary>
    /// Database stuff for the session 
    /// </summary>
    


    public class SessionContext : TableServiceContext
    {
        public const string TABLE_NAME = "Sessions";

        public SessionContext(string baseAdress, StorageCredentials storageCredentials) : base(baseAdress, storageCredentials)
        {
        }

        public IQueryable<Session> MfSessions
        {
            get
            {
                return this.CreateQuery<Session>(TABLE_NAME);
            }
        }

        public void Add(Session mfSession)
        {
            this.AddObject(TABLE_NAME, mfSession);
            this.SaveChanges();
        }

        public void Update(Session mfSession)
        {
            this.UpdateObject(mfSession);
            this.SaveChanges();
        }
    }

}
